package com.evan.review.architecture.mvvm.model;

import androidx.room.Entity;
import androidx.room.Ignore;
import androidx.room.PrimaryKey;

/**
 * 笔记数据模型
 * MVVM架构中的Model层
 * 
 * 使用Room注解，可以直接用于数据库存储
 */
@Entity(tableName = "notes")
public class Note {
    
    @PrimaryKey(autoGenerate = true)
    private int id;
    
    private String title;
    private String content;
    private String category;
    private long createdAt;
    private long updatedAt;
    private int priority; // 1-5, 5 being highest
    private boolean isArchived;
    
    public Note() {
        // 默认构造函数，Room需要
        this.createdAt = System.currentTimeMillis();
        this.updatedAt = System.currentTimeMillis();
        this.priority = 3; // 默认中等优先级
        this.isArchived = false;
    }
    
    @Ignore
    public Note(String title, String content, String category, int priority) {
        this.title = title;
        this.content = content;
        this.category = category;
        this.priority = priority;
        this.createdAt = System.currentTimeMillis();
        this.updatedAt = System.currentTimeMillis();
        this.isArchived = false;
    }
    
    // Getters and Setters
    
    public int getId() {
        return id;
    }
    
    public void setId(int id) {
        this.id = id;
    }
    
    public String getTitle() {
        return title;
    }
    
    public void setTitle(String title) {
        this.title = title;
    }
    
    public String getContent() {
        return content;
    }
    
    public void setContent(String content) {
        this.content = content;
    }
    
    public String getCategory() {
        return category;
    }
    
    public void setCategory(String category) {
        this.category = category;
    }
    
    public long getCreatedAt() {
        return createdAt;
    }
    
    public void setCreatedAt(long createdAt) {
        this.createdAt = createdAt;
    }
    
    public long getUpdatedAt() {
        return updatedAt;
    }
    
    public void setUpdatedAt(long updatedAt) {
        this.updatedAt = updatedAt;
    }
    
    public int getPriority() {
        return priority;
    }
    
    public void setPriority(int priority) {
        this.priority = priority;
    }
    
    public boolean isArchived() {
        return isArchived;
    }
    
    public void setArchived(boolean archived) {
        isArchived = archived;
    }
    
    @Override
    public String toString() {
        return "Note{" +
                "id=" + id +
                ", title='" + title + '\'' +
                ", content='" + content + '\'' +
                ", category='" + category + '\'' +
                ", createdAt=" + createdAt +
                ", updatedAt=" + updatedAt +
                ", priority=" + priority +
                ", isArchived=" + isArchived +
                '}';
    }
} 